<#include "../header.html">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	var ue = UE.getEditor('editor');

	function getWebEditText() {
		var content = UE.getEditor('editor').getContent();
		$("#content").val(content);
		$("#addForm").submit();

	}

</script>
<div class="c_nav">
	<span>管理选项：</span>
	<a href="newsAction.do?method=query">管理首页</a>
	<a href="javascript:location.reload()"> | [刷新页面]</a>
</div>
<div class="c_box bg_white">
<form id="addForm" name="addForm" action="newsAction.do?method=save" method="post">
	<div class="c_topic"><#if news.id??>修改<#else>新增</#if>资讯</div>
	<input type="hidden" name="newsId" id="newsId" value="${news.id!}"/>
	<div class="c_form_3 c_form-label-8">
	<ul class="l_mb">
		<li>
			<span class="e_label e_label-required">标题：</span>
			<span class="e_input">
				<input type="text" name="newsTitle" id="newsTitle" desc="标题" nullable="no" maxlen="40" maxlength="40" value="${news.newsTitle!}"/>
			</span>
		</li>
		<li>
			<span class="e_label e_label-required">作者：</span>
			<span class="e_input">
				<input type="text" name="author" id="author" desc="作者" nullable="no" maxlen="100" maxlength="100"   value="${news.author!}" />
			</span>
		</li>
		<li>
			<span class="e_label e_label-required">类型：</span>
			<span class="e_select">
				<select id="ctype" name="ctype" desc="类型" nullable="no">
					<#list ctypeList as obj>
					<option value="${obj.dataCode!}" <#if news.ctype?? && news.ctype?string==obj.dataCode?string> selected="selected" </#if>>${obj.dataName!}</option>
					</#list>
				</select>
			</span>
		</li>
	</ul>
	<ul class="l_mb">
		<li>
			<span class="e_label e_label-required">排序：</span>
			<span class="e_input">
				<input type="text" name="sort" id="sort" desc="排序" nullable="no" maxlen="5" maxlength="5" datatype="number" value="${news.sort!}"/>
			</span>
		</li>
		<li>
			<span class="e_label e_label-required">是否置顶：</span>
			<span class="e_radio">
				<label><input type="radio" name="isTop" desc="是否置顶" nullable="no"<#if news.isTop?? && news.isTop==0> checked="checked"</#if> value="0"/> 否</label>
				<label><input type="radio" name="isTop" desc="是否置顶" nullable="no"<#if news.isTop?? && news.isTop==1> checked="checked"</#if> value="1"/> 是</label>
			</span>
		</li>
	</ul>
	<ul class="l_mb">
		<li>
			<span class="e_label e_label-required">图片或视频：</span>
			<span class="e_input-file-btn">
				<input type="text" id="mediaUrl" name="mediaUrl" nullable="no" desc="图片或视频" readonly="readonly" value="${news.mediaUrl!}"/>
				<input type="hidden" id="oldImgSrc" name="oldImgSrc" value="${news.mediaUrl!}"/>
				<input type="hidden" id="imgId" name="imgId" value=""/>
				<button type="button" id="uploadBtn" name="uploadBtn" class="e_btn">上传文件</button>
			</span>
		</li>
		<li>
			<span class="e_label e_label-required">描述/链接：</span>
			<span class="e_textarea">
					<textarea name="describes" id="describes" maxlen="255" maxlength="255" nullable="no" placeholder="广告时可放链接">${news.describes!}</textarea>
			</span>
		</li>
	</ul>
	</div>
	<ul class="l_mb c_form_1 c_form-label-5">
		<script id="editor" type="text/plain" style="width:1024px;height:350px;">${news.content!}</script>
		<input type="hidden" name="content" id="content" value = '${news.content!}'/>
	</ul>
	<div class="e_center" >
		<button type="button" bind="" bindForm="addForm" tradeAction="getWebEditText()" class="e_btn-page">提交</button>
		<button type="reset" class="e_btn l_ml">重置</button>
	</div>
</form>
</div>
<iframe id="uploadFrame" name="uploadFrame" src="newsAction.do?method=uploadFile&resultCode=-1" frameborder="0" class="e_hide"></iframe>
<script type="text/javascript">
$(function(){
	$("#uploadBtn").click(function(){
		$("#imgFile", window.uploadFrame.document).trigger("click");
	});
});
</script>
<#include "../footer.html">